const fs = require('fs');
const path = require('path');

function myplugin02(options) {
    this.options = JSON.parse(JSON.stringify(options));
}

myplugin02.prototype.apply = function(compiler) {
    const { options } = this;
    console.log(options);
	compiler.hooks.emit.tapAsync('myplugin02', (compilation, cb) => {
		console.log('webpack 构建过程开始！');
		compilation.assets['copyright.txt'] = {
            //内容
            source: function(){
                return 'copyright by kate'
            },
            //文件大小
            size: function() {
                return 17
            }
        }
        cb()
	});
};

module.exports = myplugin02;